HAL HRTIM types migration

This section provides information about the HAL HRTIM types migration.

HAL HRTIM callback ID type definition

HAL1

HAL2

typedef enum
{
  HAL_HRTIM_FAULT1CALLBACK_CB_ID               ,
  HAL_HRTIM_FAULT2CALLBACK_CB_ID               ,
  HAL_HRTIM_FAULT3CALLBACK_CB_ID               ,
  HAL_HRTIM_FAULT4CALLBACK_CB_ID               ,
  HAL_HRTIM_FAULT5CALLBACK_CB_ID               ,
  HAL_HRTIM_SYSTEMFAULTCALLBACK_CB_ID          ,
  HAL_HRTIM_BURSTMODEPERIODCALLBACK_CB_ID      ,
  HAL_HRTIM_SYNCHRONIZATIONEVENTCALLBACK_CB_ID ,
  HAL_HRTIM_ERRORCALLBACK_CB_ID                ,
  HAL_HRTIM_REGISTERSUPDATECALLBACK_CB_ID      ,
  HAL_HRTIM_REPETITIONEVENTCALLBACK_CB_ID      ,
  HAL_HRTIM_COMPARE1EVENTCALLBACK_CB_ID        ,
  HAL_HRTIM_COMPARE2EVENTCALLBACK_CB_ID        ,
  HAL_HRTIM_COMPARE3EVENTCALLBACK_CB_ID        ,
  HAL_HRTIM_COMPARE4EVENTCALLBACK_CB_ID        ,
  HAL_HRTIM_CAPTURE1EVENTCALLBACK_CB_ID        ,
  HAL_HRTIM_CAPTURE2EVENTCALLBACK_CB_ID        ,
  HAL_HRTIM_DELAYEDPROTECTIONCALLBACK_CB_ID    ,
  HAL_HRTIM_COUNTERRESETCALLBACK_CB_ID         ,
  HAL_HRTIM_OUTPUT1SETCALLBACK_CB_ID           ,
  HAL_HRTIM_OUTPUT1RESETCALLBACK_CB_ID         ,
  HAL_HRTIM_OUTPUT2SETCALLBACK_CB_ID           ,
  HAL_HRTIM_OUTPUT2RESETCALLBACK_CB_ID         ,
  HAL_HRTIM_BURSTDMATRANSFERCALLBACK_CB_ID     ,
  HAL_HRTIM_MSPINIT_CB_ID                      ,
  HAL_HRTIM_MSPDEINIT_CB_ID                    ,
} HAL_HRTIM_CallbackIDTypeDef;
  • Removed from HAL2 : the callback registration is managed by dedicated functions for each HRTIM event. For more details, see : HAL HRTIM callbacks irq and Callbacks functions

  • HAL_HRTIM_MSPINIT_CB_ID and HAL_HRTIM_MSPDEINIT_CB_ID are removed because the functions HAL_HRTIM_MspInit() and HAL_HRTIM_MspDeInit() are removed.


HAL HRTIM state type definition

Important

In HAL1, a single global state machine HAL_HRTIM_StateTypeDef manages the entire peripheral states. In HAL2, state management is split into two separate state machines:

  • A global peripheral state machine hal_hrtim_state_t with basic states RESET and INIT.

  • Individual timer state machines hal_hrtim_timer_state_t represent the specific status of each timer.

HAL1

HAL2

typedef enum
{
  HAL_HRTIM_STATE_RESET ,
  HAL_HRTIM_STATE_READY ,
  HAL_HRTIM_STATE_BUSY ,
  HAL_HRTIM_STATE_TIMEOUT ,
  HAL_HRTIM_STATE_ERROR ,
  HAL_HRTIM_STATE_INVALID_CALLBACK
} HAL_HRTIM_StateTypeDef;
typedef enum
{
  HAL_HRTIM_STATE_RESET ,
  HAL_HRTIM_STATE_INIT  ,
} hal_hrtim_state_t;

typedef enum
{
  HAL_HRTIM_TIM_STATE_RESET ,
  HAL_HRTIM_TIM_STATE_IDLE ,
  HAL_HRTIM_TIM_STATE_ACTIVE ,
  HAL_HRTIM_TIM_STATE_ACTIVE_SILENT
} hal_hrtim_timer_state_t;

HAL HRTIM ADC trigger configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t UpdateSource;
  uint32_t Trigger;
} HRTIM_ADCTriggerCfgTypeDef;
typedef struct
{
  uint32_t update;
  uint32_t source;
} hal_hrtim_adc_sync_config_t;

HAL HRTIM burst mode configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t Mode;
  uint32_t ClockSource;
  uint32_t Prescaler;
  uint32_t Period;
  uint32_t IdleDuration;
  uint32_t Trigger;
  uint32_t PreloadEnable;
} HRTIM_BurstModeCfgTypeDef;
typedef struct
{
  hal_hrtim_burst_mode_operating_mode_t mode;
  hal_hrtim_burst_mode_clock_src_t clock;
  hal_hrtim_burst_mode_prescaler_t prescaler;
  uint16_t period;
  uint16_t idle_periods;
  uint32_t triggers;

} hal_hrtim_burst_mode_config_t;

Note

  • In HAL2, the parameter PreloadEnable is removed.

  • To enable preload mode, the user should call the API HAL_HRTIM_EnableBurstModePreload, and to disable it, he should use the API HAL_HRTIM_DisableBurstModePreload.


HAL HRTIM capture configuration type definition

HAL1

HAL2

typedef struct
{
  uint64_t Trigger;
} HRTIM_CaptureCfgTypeDef;

Removed

  • In HAL1, the structure HRTIM_CaptureCfgTypeDef, which contains only the Trigger value, is used by the API HAL_HRTIM_WaveformCaptureConfig to configure the capture trigger by passing a pointer to this structure.

  • In HAL2, this API is replaced by HAL_HRTIM_TIM_SetCaptureTrigger, which directly takes the trigger value as a uint64_t parameter, and the structure is no longer needed since the trigger can be passed directly without wrapping it in a structure.

    For more details, see : Configures waveform capture.


HAL HRTIM capture value type definition

HAL1

HAL2

typedef struct
{
  uint32_t Value;
  uint32_t Dir ;
} HRTIM_CaptureValueTypeDef;
typedef struct
{
  uint16_t value;
  hal_hrtim_capture_direction_t direction;
} hal_hrtim_capture_t;

HAL HRTIM chopper mode configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t StartPulse;
  uint32_t DutyCycle;
  uint32_t CarrierFreq;
} HRTIM_ChopperModeCfgTypeDef;
typedef struct
{
  hal_hrtim_chopper_pulse_t start_pulse_width;
  hal_hrtim_chopper_duty_cycle_t duty_cycle;
  hal_hrtim_chopper_prescaler_t prescaler;
} hal_hrtim_chopper_config_t;

HAL HRTIM compare configuration type definition

HAL1

HAL2

In HAL1, this structure is passed as a single parameter to the API HAL_HRTIM_WaveformCompareConfig.

typedef struct
{
  uint32_t CompareValue;






  uint32_t AutoDelayedMode;
  uint32_t AutoDelayedTimeout;

} HRTIM_CompareCfgTypeDef;

In HAL2, this API is split into two distinct APIs :

  • HAL_HRTIM_TIM_SetCompareValue to set the CompareValue directly.

  • HAL_HRTIM_TIM_SetAutoDelayedMode to configure the auto-delayed mode using hal_hrtim_auto_delayed_config_t structure.

    hal_status_t HAL_HRTIM_TIM_SetCompareValue(hal_hrtim_handle_t *hhrtim,
                                     uint32_t timer,
                                     hal_hrtim_compare_unit_t compare_unit,
                                     uint16_t compare_value);
    
    typedef struct
    {
      hal_hrtim_auto_delayed_mode_t mode;
      uint16_t timeout_cycles;
    
    } hal_hrtim_auto_delayed_config_t;
    

HAL HRTIM dead time configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t Prescaler;

  uint32_t RisingValue;
  uint32_t FallingValue;
  uint32_t RisingSign;
  uint32_t FallingSign;

  uint32_t RisingLock;
  uint32_t RisingSignLock;
  uint32_t FallingLock;
  uint32_t FallingSignLock;
} HRTIM_DeadTimeCfgTypeDef;


hal_status_t HAL_HRTIM_TIM_SetDeadtimePrescaler(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_deadtime_prescaler_t prescaler);

typedef enum
{
  HAL_HRTIM_DEADTIME_RISING = 0U,

  HAL_HRTIM_DEADTIME_FALLING = 1U,

} hal_hrtim_deadtime_t;

typedef struct
{
  uint16_t value;

  hal_hrtim_deadtime_sign_t sign;

} hal_hrtim_deadtime_config_t;

hal_status_t HAL_HRTIM_TIM_SetLockDeadtime(hal_hrtim_handle_t *hhrtim, uint32_t timer,
                                           hal_hrtim_deadtime_t deadtime,
                                           hal_hrtim_deadtime_lock_t lock);

Note

In HAL2, dead time configuration is modularized. First, the prescaler is set using HAL_HRTIM_TIM_SetDeadtimePrescaler. Then, the dead time value and sign are configured for rising or falling edges using the hal_hrtim_deadtime_config_t structure by calling HAL_HRTIM_TIM_SetConfigDeadtime function. Finally, the dead time settings can be locked separately using HAL_HRTIM_TIM_SetLockDeadtime.


HAL HRTIM event configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t Source;

  uint32_t Sensitivity;
  uint32_t Polarity;

  uint32_t Filter;
  uint32_t FastMode;
} HRTIM_EventCfgTypeDef;
typedef struct
{
  hal_hrtim_eev_src_t source;

  hal_hrtim_eev_sensitivity_t sensitivity;


  hal_hrtim_filter_t filter;
  hal_hrtim_eev_mode_t mode;
} hal_hrtim_eev_config_t;

Note

  • In HAL2, the parameters sensitivity and polarity are combined into a single enumeration called hal_hrtim_eev_sensitivity_t


HAL HRTIM external event configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t Counter;
  uint32_t Source;
  uint32_t ResetMode;
} HRTIM_ExternalEventCfgTypeDef;
typedef struct
{
  uint32_t threshold;
  uint32_t event;
  hal_hrtim_eev_counter_reset_mode_t reset_mode;
} hal_hrtim_eev_counter_config_t;

HAL HRTIM fault blanking configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t Threshold;
  uint32_t ResetMode;


  uint32_t BlankingSource;
} HRTIM_FaultBlankingCfgTypeDef;
typedef struct
{
  uint8_t threshold;
  hal_hrtim_flt_counter_reset_mode_t reset_mode;
} hal_hrtim_flt_counter_config_t;

hal_hrtim_flt_blk_t blanking_source;

HAL HRTIM fault configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t Source;
  uint32_t Polarity;
  uint32_t Filter;


  uint32_t Lock;
} HRTIM_FaultCfgTypeDef;
typedef struct
{
  hal_hrtim_flt_src_t source;
  hal_hrtim_flt_polarity_t polarity;
  hal_hrtim_filter_t filter;
} hal_hrtim_flt_config_t;

Note

  • The parameter Lock is removed in HAL2, if the user needs to lock the fault mode, he must call the following API

hal_status_t HAL_HRTIM_FLT_Lock(hal_hrtim_handle_t *hhrtim, uint32_t fault)

HAL HRTIM handle type definition

HAL1

HAL2

typedef HRTIM_HandleTypeDef;
typedef hal_hrtim_handle_t;

HAL HRTIM initialization type definition

HAL1

HAL2

typedef struct
{
  uint32_t SyncInputSource;
  uint32_t SyncOutputSource;
  uint32_t SyncOutputPolarity;

  uint32_t HRTIMInterruptRequests;
  uint32_t SyncOptions;
} HRTIM_InitTypeDef;


hal_hrtim_sync_input_src_t sync_input_source;
hal_hrtim_sync_output_src_t source;
hal_hrtim_sync_output_mode_t mode;

Note

  • HRTIMInterruptRequests

    • In HAL2, the parameter HRTIMInterruptRequests is removed, user could use the API HAL_HRTIM_SetConfigInterrupts instead.

  • SyncOptions

    • In HAL1, the SyncOptions parameter could be configured to operate as a slave, a master, or both.

    • In HAL2, this parameter is removed. Instead, users must explicitly call the API HAL_HRTIM_TIM_SetSlaveMode for slave mode configuration, and HAL_HRTIM_SetSynchroOutput to configure master mode.


HAL HRTIM time base configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t Period;

  uint32_t RepetitionCounte

  uint32_t PrescalerRatio;

  uint32_t Mode;

} HRTIM_TimeBaseCfgTypeDef;
typedef struct
{
 uint16_t period;

 uint16_t repetition;

 hal_hrtim_timer_prescaler_t prescaler;

 hal_hrtim_timer_operating_mode_t operating_mode;



 hal_hrtim_timer_counting_mode_t counting_mode;

}hal_hrtim_timer_config_t;

For more details, time base configuration


HAL HRTIM output configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t SetSource;
  uint32_t ResetSource;
  uint32_t Polarity;
  uint32_t IdleLevel;
  uint32_t FaultLevel;


  uint32_t ChopperModeEnable;

  uint32_t BurstModeEntryDelayed;
  uint32_t IdleMode;

} HRTIM_OutputCfgTypeDef;
typedef struct
{
  uint32_t set;
  uint32_t reset;
  hal_hrtim_output_polarity_t polarity;
  hal_hrtim_output_idle_level_t idle_level;
  hal_hrtim_output_fault_level_t fault_level;
} hal_hrtim_output_config_t;

  hal_hrtim_chopper_status_t chopper_mode_status;

  hal_hrtim_output_burst_mode_t output_burst_mode;

Note

  • In HAL2, the parameters BurstModeEntryDelayed and IdleMode are combined into a single enumeration called hal_hrtim_output_burst_mode_t


HAL HRTIM simple capture channel configuration type definition

HAL1

HAL2

/* Structure used in HAL1 for simple capture
channel configuration */



typedef struct
{
  uint32_t Event;

  uint32_t EventPolarity;
  uint32_t EventSensitivity;

  uint32_t EventFilter;



} HRTIM_SimpleCaptureChannelCfgTypeDef;

In HAL2, the “simple” APIs have been removed. Consequently, the HRTIM_SimpleCaptureChannelCfgTypeDef structure and the associated API HAL_HRTIM_SimpleCaptureChannelConfig are no longer available.

Equivalent functionality can be achieved by configuring parameters in the new HAL2 structures:

typedef struct
{
  hal_hrtim_eev_src_t source;

  hal_hrtim_eev_sensitivity_t sensitivity;


  hal_hrtim_filter_t filter;

  hal_hrtim_eev_mode_t mode;

} hal_hrtim_eev_config_t;

Note

  • In HAL2, the parameters sensitivity and polarity are combined into a single enumeration: hal_hrtim_eev_sensitivity_t.

  • To replicate the simple capture configuration, in addition to the chosen HAL2 settings, the external event mode must be set to HAL_HRTIM_EEV_SYNCHRONOUS.

  • For more details, refer to the Simple function migration.


HAL HRTIM simple output compare channel configuration type definition

HAL1

HAL2

/* Structure used in HAL1 for simple output compare
channel configuration */


typedef struct
{
 uint32_t Pulse;



 uint32_t Mode;





 uint32_t Polarity;


 uint32_t IdleLevel;




} HRTIM_SimpleOCChannelCfgTypeDef;

In HAL2, the “simple” APIs are removed. Consequently, the HRTIM_SimpleOCChannelCfgTypeDef structure and the associated API HAL_HRTIM_SimpleOCChannelConfig are no longer available.

Equivalent functionality can be achieved by configuring the relevant parameters in the new HAL2 structure, for example:

/* Set the compare value corresponding to the pulse */
HAL_HRTIM_TIM_SetCompareValue(&hrtim, HAL_HRTIM_TIMx, HAL_HRTIM_COMPARE_UNIT_i, pulse_value);

typedef struct
{
 /** Combination of events forcing the output to its ACTIVE level */
 uint32_t set;
 /** Combination of events forcing the output to its INACTIVE level */
 uint32_t reset;


 hal_hrtim_output_polarity_t polarity;


 hal_hrtim_output_idle_level_t idle_level;


 hal_hrtim_output_fault_level_t fault_level;

} hal_hrtim_output_config_t;

Note

  • In HAL1, the Mode field selected the output compare mode. In HAL2, this is replaced by configuring the set and reset fields to specify the combination of events that force the output to its ACTIVE or INACTIVE level, respectively.

  • To replicate the simple OC channel configuration, set the fault_level to HAL_HRTIM_OUTPUT_FAULT_NONE.

  • For more details, refer to the Simple function migration.


HAL HRTIM simple one pulse channel configuration type definition

HAL1

HAL2

/* Structure used in HAL1 for simple one pulse
   channel configuration */


typedef struct
{

  uint32_t Pulse;



  uint32_t OutputPolarity;

  uint32_t OutputIdleLevel;












  uint32_t Event;

  uint32_t EventSensitivity;
  uint32_t EventPolarity;


  uint32_t EventFilter;



} HRTIM_SimpleOnePulseChannelCfgTypeDef;

In HAL2, the “simple” APIs are removed. Consequently, the HRTIM_SimpleOnePulseChannelCfgTypeDef structure and the associated API HAL_HRTIM_SimpleOnePulseChannelConfig are no longer available.

Equivalent functionality can be achieved by configuring the relevant parameters in the new HAL2 structures, for example:

/* Set the compare value corresponding to the pulse */

HAL_HRTIM_TIM_SetCompareValue(&hrtim, HAL_HRTIM_TIMx, HAL_HRTIM_COMPARE_UNIT_i, Pulse);

typedef struct
{
  hal_hrtim_output_polarity_t polarity;

  hal_hrtim_output_idle_level_t idle_level;


  hal_hrtim_output_fault_level_t fault_level;

  uint32_t set;
  uint32_t reset;


} hal_hrtim_output_config_t;

typedef struct
{
  hal_hrtim_eev_src_t source;

  hal_hrtim_eev_sensitivity_t sensitivity;



  hal_hrtim_filter_t filter;

  hal_hrtim_eev_mode_t mode;


} hal_hrtim_eev_config_t;

Note

  • In HAL2, the parameters EventSensitivity and EventPolarity are combined into a single enumeration: hal_hrtim_eev_sensitivity_t.

  • To replicate the simple one pulse configuration, in addition to the chosen HAL2 settings, you must:

    • Set the fault_level to HAL_HRTIM_OUTPUT_FAULT_NONE.

    • Configure the output reset source to the timer period event, so the output is forced to its inactive state at the end of the period.

    • Configure the output set source to the timer compare event, so the output is forced to its active state on compare match.

    • Set the external event mode to HAL_HRTIM_EEV_SYNCHRONOUS.

  • For more details, refer to the Simple function migration.


HAL HRTIM simple PWM channel configuration type definition

HAL1

HAL2





typedef struct
{
  uint32_t Pulse;



  uint32_t Polarity;

  uint32_t IdleLevel;





} HRTIM_SimplePWMChannelCfgTypeDef;

In HAL2, the “simple” APIs are removed. Consequently, the HRTIM_SimplePWMChannelCfgTypeDef structure, which was used in HAL_HRTIM_SimplePWMChannelConfig function, is no longer available.

Equivalent functionality can be achieved by configuring the relevant parameters in the new HAL2 structure, for example:

For more details, refer to Simple function migration

HAL_HRTIM_TIM_SetCompareValue(&hrtim, HAL_HRTIM_TIMx, HAL_HRTIM_COMPARE_UNIT_i, pulse_value);

typedef struct
{
  hal_hrtim_output_polarity_t polarity;

  hal_hrtim_output_idle_level_t idle_level;

  hal_hrtim_output_fault_level_t fault_level;

  uint32_t set;
  uint32_t reset;
} hal_hrtim_output_config_t;

Note

  • To replicate the simple PWM channel configuration, in addition to the chosen HAL2 settings, you must:

    • Set the fault_level to HAL_HRTIM_OUTPUT_FAULT_NONE.

    • Configure the output reset source to the timer period event, so the output is forced to its inactive state at the end of the period.

    • Configure the output set source to the timer compare event, so the output is forced to its active state on compare match.


HAL HRTIM timer event filtering configuration type definition

HAL1

HAL2

typedef struct
{
  uint32_t Filter;
  uint32_t Latch;

} HRTIM_TimerEventFilteringCfgTypeDef;
typedef struct
{
  uint32_t filter;
  hal_hrtim_eev_notification_t notification;

} hal_hrtim_eev_filter_config_t;

HAL HRTIM timer configuration type definition

HAL1

HAL2

typedef struct
{
 /* Interrupts configuration */
  uint32_t InterruptRequests;

 /* DMA configuration */




  uint32_t DMARequests;
  uint32_t DMASrcAddress;
  uint32_t DMADstAddress;
  uint32_t DMASize;


 /* Synchronous start/reset enabling */
  uint32_t StartOnSync;
  uint32_t ResetOnSync;

/* DAC synchronization mode selection  */
  uint32_t DACSynchro;

/* Registers preload enabling/disabling  */
  uint32_t PreloadEnable;


/* Update gating mode selection */
  uint32_t UpdateGating;

 /* Burst mode selection */
  uint32_t BurstMode;

 /* Update on repetition enabling */
  uint32_t RepetitionUpdate;

/*Push-pull mode enabling/disabling */
  uint32_t PushPull;


/* Fault inputs enabling */
  uint32_t FaultEnable;


/* Fault lock selection */
  uint32_t FaultLock;

/* Deadtime insertion enabling/disabling */
  uint32_t DeadTimeInsertion;


/* Delayed protection mode selection */
  uint32_t DelayedProtectionMode;


/* Update trigger selection and update on counter reset enabling */
  uint32_t UpdateTrigger;
  uint32_t ResetUpdate;

  uint32_t ResetTrigger;

} HRTIM_TimerCfgTypeDef;


/* Interrupts configuration */
hal_status_t HAL_HRTIM_SetConfigInterrupts(hal_hrtim_handle_t *hhrtim, hal_hrtim_interrupt_src_t source, uint32_t interrupts);

/* DMA configuration */
hal_status_t HAL_HRTIM_SetConfigDMA(hal_hrtim_handle_t *hhrtim, hal_hrtim_dma_src_t source, hal_hrtim_dma_config_t *config);

typedef struct
{
  uint32_t requests;
  uint32_t src_addr;
  uint32_t dest_addr;
  uint32_t size_byte;
} hal_hrtim_dma_config_t;

/* Synchronous start/reset enabling */
hal_status_t HAL_HRTIM_TIM_SetSlaveMode(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_tim_slave_mode_t slave_mode);


/* DAC synchronization mode selection  */
hal_status_t HAL_HRTIM_TIM_SetDACTrigger(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_dac_trigger_t dac_trigger);

/* Registers preload enabling/disabling  */
hal_status_t HAL_HRTIM_TIM_EnablePreload(hal_hrtim_handle_t *hhrtim,uint32_t timer);
hal_status_t HAL_HRTIM_TIM_DisablePreload(hal_hrtim_handle_t *hhrtim, uint32_t timer);

/* Update gating mode selection */
hal_status_t HAL_HRTIM_TIM_SetUpdateGating(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_update_gating_t update_gating);

/* Burst mode selection */
hal_status_t HAL_HRTIM_TIM_SetBurstMode(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_timer_burst_mode_t timer_burst_mode);

/* Update on repetition enabling */
hal_status_t HAL_HRTIM_TIM_SetRepetition(hal_hrtim_handle_t *hhrtim, uint32_t timer, uint16_t repetition);

/*Push-pull mode enabling/disabling*/
hal_status_t HAL_HRTIM_TIM_EnablePushPull(hal_hrtim_handle_t *hhrtim, uint32_t timer);
hal_status_t HAL_HRTIM_TIM_DisablePushPull(hal_hrtim_handle_t *hhrtim, uint32_t timer);

/* Fault inputs enabling/disabling */
hal_status_t HAL_HRTIM_TIM_EnableFault(hal_hrtim_handle_t *hhrtim, uint32_t timer, uint32_t faults);
hal_status_t HAL_HRTIM_TIM_DisableFault(hal_hrtim_handle_t *hhrtim, uint32_t timer, uint32_t faults);

/* Fault lock selection */
hal_status_t HAL_HRTIM_TIM_LockFault(hal_hrtim_handle_t *hhrtim, uint32_t timer);

/* Deadtime insertion enabling / disabling */
hal_status_t HAL_HRTIM_TIM_EnableDeadtime(hal_hrtim_handle_t *hhrtim, uint32_t timer);
hal_status_t HAL_HRTIM_TIM_DisableDeadtime(hal_hrtim_handle_t *hhrtim, uint32_t timer);

/* Delayed protection mode selection */
hal_status_t HAL_HRTIM_TIM_EnableDelayedProtection(hal_hrtim_handle_t *hhrtim,uint32_t timer);
hal_status_t HAL_HRTIM_TIM_DisableDelayedProtection(hal_hrtim_handle_t *hhrtim, uint32_t timer);

/* Update trigger selection and update on counter reset enabling */
hal_status_t HAL_HRTIM_TIM_SetUpdateSource(hal_hrtim_handle_t *hhrtim, uint32_t timer, uint32_t update_source);


hal_status_t HAL_HRTIM_TIM_SetResetSource(hal_hrtim_handle_t *hhrtim, uint32_t timer, uint32_t reset_sources);

HAL HRTIM timer control type definition

HAL1

HAL2

typedef struct
{
/* Timer counter mode */
  uint32_t UpDownMode;



/* Triggered half mode */
  uint32_t TrigHalf;

  /* Greater than compare */
  uint32_t GreaterCMP3;
  uint32_t GreaterCMP1;

  /* Dual channel DAC configuration */
  uint32_t DualChannelDacReset;
  uint32_t DualChannelDacStep;
  uint32_t DualChannelDacEnable;
} HRTIM_TimerCtlTypeDef;


/* Timer counter mode */
hal_status_t HAL_HRTIM_TIM_SetCountingMode(hal_hrtim_handle_t *hhrtim,
                                 uint32_t timer,
                                 hal_hrtim_timer_counting_mode_t counting_mode);

/* Triggered half mode */
hal_hrtim_trig_half_mode_t mode;

/* This function is used to perform a "greater than" comparison, specifically for compare 1 or compare 3 operations. */
hal_status_t HAL_HRTIM_TIM_EnableGTCompare(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_compare_unit_t compare_unit);
hal_status_t HAL_HRTIM_TIM_DisableGTCompare(hal_hrtim_handle_t *hhrtim, uint32_t timer, hal_hrtim_compare_unit_t compare_unit);

/* Dual channel DAC configuration */
hal_status_t HAL_HRTIM_TIM_SetDualChannelDACTriggers(hal_hrtim_handle_t *hhrtim,
                                           uint32_t timer,
                                           const hal_hrtim_dual_channel_dac_triggers_config_t *p_config);
hal_status_t HAL_HRTIM_TIM_EnableDualChannelDAC(hal_hrtim_handle_t *hhrtim, uint32_t timer);

HAL HRTIM timer param type definition

HAL1

HAL2

typedef struct
{
  uint32_t InterruptRequests;



  uint32_t DMARequests;
  uint32_t DMASrcAddress;
  uint32_t DMADstAddress;
  uint32_t DMASize;


  uint32_t CaptureTrigger1;
  uint32_t CaptureTrigger2;


} HRTIM_TimerParamTypeDef;
/* Interrupts configuration */

hal_status_t HAL_HRTIM_SetConfigInterrupts(hal_hrtim_handle_t *hhrtim,
                                          hal_hrtim_interrupt_src_t source,
                                          uint32_t interrupts);

/* DMA configuration */

hal_status_t HAL_HRTIM_SetConfigDMA(hal_hrtim_handle_t *hhrtim, hal_hrtim_dma_src_t source, hal_hrtim_dma_config_t *config);



hal_status_t HAL_HRTIM_TIM_SetCaptureTrigger(hal_hrtim_handle_t *hhrtim,
                                            uint32_t timer,
                                            hal_hrtim_capture_unit_t capture_unit,
                                            uint64_t triggers);

Note

To have the same sequence of configuration as available in HAL1 for CaptureTrigger1 and CaptureTrigger2, you must call HAL_HRTIM_TIM_SetCaptureTrigger twice, changing the parameter capture_unit to capture unit 1 and capture unit 2 respectively.


HAL HRTIM callback type definition

HAL1

HAL2

pHRTIM_CallbackTypeDef
In HAL2, the HRTIM callback function pointer is split into multiple specific callback typedefs, each corresponding to a particular functionality.

hal_hrtim_timer_cb_t
hal_hrtim_fault_cb_t

HAL HRTIM timer x callback type definition

HAL1

HAL2

pHRTIM_TIMxCallbackTypeDef
In HAL2, the HRTIM Timer x callback function pointer is split into multiple specific callback typedefs, each corresponding to a particular functionality.
For example:

 hal_hrtim_timer_cb_t
 hal_hrtim_output_cb_t
 hal_hrtim_cmp_cb_t
 hal_hrtim_cpt_cb_t